import logging

# 最简单的彩色日志配置
def enable_colored_logging():
    class ColorFormatter(logging.Formatter):
        def format(self, record):
            colors = {
                'ERROR': '\033[31m', 'WARNING': '\033[33m', 'INFO': '\033[32m',
                'DEBUG': '\033[36m', 'CRITICAL': '\033[35m'
            }
            color = colors.get(record.levelname, '')
            reset = '\033[0m'
            return f"{color}{super().format(record)}{reset}"
    
    # 配置根logger
    handler = logging.StreamHandler()
    handler.setFormatter(ColorFormatter('%(levelname)s: %(message)s'))
    logging.root.handlers = [handler]
    logging.root.setLevel(logging.DEBUG)